package timer;

import java.text.SimpleDateFormat;
import java.util.logging.SimpleFormatter;

public class ExecTask implements Runnable {
    private int counter;
    private SimpleDateFormat sf;

    public ExecTask(int counter) {
        this.counter = counter;
    }

    @Override
    public void run() {
        sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println("time"+counter+":"+sf.format(System.currentTimeMillis()));
        try {
            Thread.sleep(2000L);
            System.out.println("finshed:"+sf.format(System.currentTimeMillis()));
        } catch (Exception ex) {
            ex.printStackTrace();
        }

    }
}
